package com.example.exception;

import com.example.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice("com.example")
@Slf4j
public class GlobalException {
    @ExceptionHandler(Exception.class)
    public Object handlerException(Exception e){
        log.error("系统异常"+e.getMessage());
        return Result.error(500,e.getMessage());
    }
}
